/**
 * Created by Jay on 2016/6/13.
 */
function q_manager(){
    var pre_ran;
    $("body").on("click",".rep_search",function(){
        var this_search=$(".rep_search_real").val();
        if(this_search==" "){
            return;
        }
        $.ajax({
           url:"keyWordController/searchKeyWord",
           method:"POST",
           data: {pageSize:10, pageNo:1,content:this_search}
        })
        .done(function(data){
            //data.result.resultList=data.result;
            set_seqsum(
                {
                    pageNo:data.result.pageNo,
                    pageSize:data.result.pageSize
                }
            );
            create_page({
                url:"keyWordController/getAllKeyWord",
                method:"get",
                data:data,
                temp:"getColumnTableData_q",
                contain:"#ColumnTableData_q",
                prePageSize:data.result.pageSize,
                prepageNo:data.result.pageNo
            })//生成分页
            var return_data=1*data.result.pageNo;//返回的首位数
            sessionStorage.setItem("pageNo",data.result.pageNo);
            sessionStorage.setItem("pageSize",data.result.pageSize);
            sessionStorage.setItem("return_data",return_data);
            var page=get_page_size();
            mccmsa.getHtmlFromLocalTemplate({   //将数据打包到模版丢进容器
                templateId:"getColumnTableData_q",
                container:$("#ColumnTableData_q"),
                data:data,
                callback:function(){
                }
            })
        })
    })
    $("body").on("click",".aw_click",function(e){
        e.stopPropagation();
        var keyw=$("#sensation").val();
        //console.log(keyw);
        mccmsa.ajax({
            url:"keyWordController/addKeyWord",
            method:"POST",
            data:{keyword:keyw},
            success:function(){
                layer.alert("成功添加敏感词");
                //刷新页面
                mccmsa.hashChange();
            }
        })
    })
    $("body").on("click",".del_w",function(e){
        e.stopPropagation();
        var del_id=$(this).attr("data-did");
        layer.open({
            content: '确定要删除？',
            btn: ['确认','取消'],
            yes: function(index, layero){
                mccmsa.ajax({
                    url: "keyWordController/delKeyWord",
                    method: "get",
                    data: {keywordId:del_id},
                    success: function (data) {
                        layer.alert("成功删除敏感词");
                        //刷新页面
                        mccmsa.hashChange();
                    }
                })
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            },
            cancel:function(index ,layero){
               return ; //弹出
            }
        });
    })
    mccmsa.ajax({
        url: "keyWordController/getAllKeyWord",
        method: "get",
        data: {pageSize: 10, pageNo: 1},
        success: function (data) {
            set_seqsum(
                {
                    pageNo:data.result.pageNo,
                    pageSize:data.result.pageSize
                }
            );
            create_page({
                url:"keyWordController/getAllKeyWord",
                method:"get",
                data:data,
                temp:"getColumnTableData_q",
                contain:"#ColumnTableData_q",
                prePageSize:data.result.pageSize,
                prepageNo:data.result.pageNo
            })//生成分页
            var return_data=1*data.result.pageNo;//返回的首位数
            sessionStorage.setItem("pageNo",data.result.pageNo);
            sessionStorage.setItem("pageSize",data.result.pageSize);
            sessionStorage.setItem("return_data",return_data);
            var page=get_page_size();
            mccmsa.getHtmlFromLocalTemplate({   //将数据打包到模版丢进容器
                templateId: "getColumnTableData_q",
                container: $("#ColumnTableData_q"),
                data: data,
                callback:function(){
                }
            })
        }
    })

}